<div>
    <b>
        All Patient List
    </b>
    <table style="width:100%;">
        <tr style="background-color:#CCCCCC;">
            <th>Sr. No.</th>
            <th>Date</th>
            <th>Patient ID</th>
            <th>Name</th>
            <th>Sex</th>
            <th>Age</th>
        </tr>
        <c:if test="${fn:length(model.labOrders) == 0}"><tr><td>No Orders</td></tr></c:if>
        <c:forEach items="${model.labOrders}" var="order" varStatus="orderStatus">
            <c:if test="${!empty order.orderId}">
                <tr id="viewOrderRow${order.orderId}" class="existingOrderRow">

                    <td>
                        ${orderStatus.count}
                    </td>
                    <td><openmrs:formatDate date="${order.startDate}" /></td>

                <td>${order.patient.patientIdentifier}</td>
                <td>
                    <a href="${pageContext.request.contextPath}/module/simplelabentry/resultEntry.htm?orderDate=${param.orderDate}&identifier=${order.patient.patientIdentifier}&labName=${param.labName}" target="_blank">
                        ${order.patient.personName.givenName} ${order.patient.personName.familyName}
                    </a>
                </td>
                <td>${order.patient.gender}</td>
                <td>${order.patient.age}</td>
                <td>${empty order.concept.name.shortName ? order.concept.name.name : order.concept.name.shortName}</td>
                <c:if test="${model.workList == null || model.workList == 'false'}">
                    <td>
                    <input type="checkbox" value="<c:choose><c:when test="${order.accessionNumber == '1'}">1" checked="checked"</c:when><c:otherwise>0"</c:otherwise></c:choose>
                    onclick="acceptOrder('${order.orderId}',this.checked);"/><img src="" style="float:right" id="acceptMsg${order.orderId}"/>
                    </td>
                </c:if>
                <c:if test="${model.workList == null || model.workList == 'false' }">
                    <td>
                    <c:if test="${order.accessionNumber == '1'}">

                        <a href="javascript:showPrint('${order.patient.personName.givenName} ${order.patient.personName.familyName}','${order.patient.patientIdentifier}','${order.patient.gender}','${order.patient.age}','${empty order.concept.name.shortName ? order.concept.name.name : order.concept.name.shortName}','<openmrs:formatDate date="${order.startDate}" />');" id="printLabel"/><small>Print Label</small>

                    </c:if>
                    </td>
                </c:if>


                <c:if test="${model.workList != null && model.workList == 'true' && param.groupKey != null && param.groupKey != 'Select' && model.futureDate == 'false'}">
                    <td>
                        <a href="javascript:editOrder('${order.orderId}');"><small>Enter Results</small></a>
                    </td>
                </c:if>
                <c:if test="${model.workList == null || model.workList == 'false'}">
                    <td>
                        <a href="javascript:rescheduleOrder('${order.orderId}');"><small>Reschedule</small></a>
                    </td>
                </c:if>


                </tr>
                <tr><td colspan="12" class="editOrderRow" style="display:none; background-color:#CCCCCC; border:2px solid blue;" id="editOrderRow${order.orderId}"></td></tr>

            </c:if>
        </c:forEach>
    </table>
</div>